import ApiComm from '../ApiComm'

export default {
  queryInstance: (query) => {
    return ApiComm.$http.post('/workflow/instance', query)
  },
  getInstance: (processInstanceId) => {
    return ApiComm.$http.get('/workflow/instance/' + processInstanceId)
  },
  terminationInstance: (processInstanceId, reason) => {
    return ApiComm.$http.delete('/workflow/instance/termination', {
      data: {
        processInstanceId: processInstanceId,
        reason: reason
      }
    })
  },
  getInstanceActivity: (processInstanceId) => {
    return ApiComm.$http.get('/workflow/history/' + processInstanceId)
  },
  getTaskList(processInstanceId) {
    return ApiComm.$http.get('/workflow/task-list/' + processInstanceId)
  },
  transferTask(taskId, userId) {
    return ApiComm.$http.patch('/workflow/transfer/' + taskId + '/' + userId)
  },
  distributeTask(taskId, userId) {
    return ApiComm.$http.patch('/workflow/distribute/' + taskId + '/' + userId)
  },
  getDefinition(processInstanceId) {
    return ApiComm.$http.get('/workflow/instance-definition/' + processInstanceId)
  },
  getHighlight(processInstanceId) {
    return ApiComm.$http.get('/workflow/instance-highlight/' + processInstanceId)
  }
}
